﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Maticsoft.DBUtility;

public partial class api_bj100 : FBasePage
{
    // Fields
    protected string allcity = "全国";
    protected DataTable teamtable = new DataTable();

    // Methods
    public DataTable GetTeams()
    {
        return (this.teamtable = DbHelperSQL.SelectByFilter("*", string.Empty, "Begin_time desc", "(select t2.*,title,homepage,Contact,Phone,Address,location from (select t1.*,Category.Name as groupname from(select Team.Id as teamid,Category.Name as cityname,Team.Product as productname,Team.Image,team.Partner_id,Team.Begin_time,Team.End_time,Team.Market_price,Team.Team_price,Team.Now_number,Per_number,Min_number,Team.Summary,Team.Detail,Team.Group_id from Team left join Category on(Team.City_id=Category.Id) where Team.Begin_time<='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'<=Team.End_time and Team.Team_type='normal' and ((Team.Max_number>0 and Team.Now_number<Team.Max_number)or(Team.Max_number=0)))  t1 left join Category on(t1.Group_id=Category.Id)) as t2 left join partner on t2.Partner_id=partner.id) t3"));
    }

}